Skip to content

feat(web): a Terminals page for shells tied to no chat - #1032

Merged
badcuban merged 2 commits into
mainfrom
feat/terminals-page
Nov 21, 2026
Merged

badcuban merged 2 commits into
mainfrom
feat/terminals-page

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

Closes #1017.

The terminal drawer inside a thread is tied to that thread's project, so watching a web server and an API from different projects meant switching chats or keeping another terminal window open. A new Terminals button in the left bar (Cmd/Ctrl+Shift+J, also in the command palette and the desktop Go menu) now opens a full-width page of terminal tabs and splits. "New tabs in [project]" picks the folder for the next tab or split, grouped by computer. Each computer keeps its own set of tabs, each tab names its folder, and shells keep running while you browse threads. Nothing on the page starts a chat or an agent. The per-thread drawer is unchanged for users; both now use one shared ManagedTerminalDrawer.

How it's kept: each computer's server holds the page's tabs under one reserved terminal thread id, terminals-page (TERMINALS_PAGE_THREAD_ID in contracts). The server refuses to create a thread with that id. Tab lists, history and "Run again" after a restart work as they do for a thread, and deleting or archiving a thread never touches the page. The client exempts the key from orphan cleanup and from the unknown-thread event filter.

Behavior in edge cases:

  • Killing a tab removes it from the screen at once and from the cached server list once the kill succeeds. A failed kill puts the tab back and says so. This applies to the thread drawer too.
  • A Restart confirmation closes itself if its tab disappears (for example, killed in another window), so it can't bring the tab back.
  • A project removed while its tab runs: the shell keeps running and the tab shows the folder name.
  • A computer going offline shows a note, and its tabs come back on reconnect.
  • On a phone the page shows in the bottom row as "Shells".

Known limits: a thread that already had the id terminals-page before this change would share the page's tabs; only a hand-made API call could have made one. On servers too old to send a tab list, a second device won't find the page's tabs and a tab's folder label is lost after a reload.

Reviews: GPT-6.2 Astra reviewed the full diff (6 of 9 findings fixed; the rest are rare or app-wide), then the later store change and drawer extraction (no drawer regression; both bugs it found are fixed in the second commit). Also fixed: the browser test harness answered terminal.close with {} instead of nothing, which the old code hid by swallowing the error.

Checked: fmt, lint, typecheck, web unit tests, server tests (decider, invariants, guide), contracts/shared/desktop tests, ThreadTerminalDrawer and ChatView.shell browser specs (63/63, three runs), full web browser suite (failures were in untouched files and passed alone), and a live run with a throwaway server.

This conflicts with #1031 (General chats placement) in NavigationRail.tsx and navigationRail.logic.ts; whichever merges second gets a rebase.

The rail gets a Terminals destination: a full-width page of terminal tabs
and split panes that belong to no thread. "New tabs in" in the title row
picks the project the next tab or split starts in, grouped under each
computer's name; picking a project on another computer shows that
computer's tabs. Each tab names its folder. Shells keep running while you
browse threads, and nothing there starts an agent or makes a chat.

Each server keeps its page's tabs under one reserved terminal thread id
(TERMINALS_PAGE_THREAD_ID, "terminals-page"); requireThreadAbsent refuses
to create a thread with it. Tab lists, history and "Run again" after a
restart work as they do for a thread. The client keeps the page's layout
through orphan cleanup and applies its terminal events with no thread
behind them; removing a computer drops it.

The thread drawer is unchanged for users. Its store wiring moves into a
shared ManagedTerminalDrawer, the kill/restart question into
TerminalStopConfirmDialog, and killing a tab into killTerminalTab; the
drawer gains a page layout (fills the page, no hide or height edge, splits
stack on phones, no "Restart here", no "Add to chat"). Killing a tab now
also drops it from the local copy of the server's list, so an old list
can't bring it back.

Also: Cmd/Ctrl+Shift+J (navigate.terminals), the command palette (Open
Terminals, and the terminal actions while the page is open), the desktop
Go menu, the port-in-use notice's Show for a holder on the page, the app
guide's Terminals place and topic, and docs/terminal.md.
…an't revive a killed one

Killing a tab dropped it from this device's copy of the server's list
before the server answered, and a failed close fell back to typing "exit"
into the shell. When the kill failed, the page showed no tab while its
shell still ran and held its port. Now the tab leaves the cached list only
once close succeeds; on failure it comes back and a toast says the kill
failed. The "exit" fallback stays only for servers without close. The
thread drawer shares this code (killTerminalTab), so it gets the fix too.

The kill/restart question (TerminalStopConfirmDialog) now knows its tab.
It closes as soon as the tab leaves this device's layout (killed on
another device), and Confirm re-checks first, so a Restart confirmed late
can no longer start a shell another window just killed. Both the thread
drawer and the Terminals page pass their tab in.

The browser harness now answers terminal.close and terminal.clear the way
the server does (nothing), instead of with a body the client rejects.
@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 20, 2026 11:56pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 5bb9005 Nov 21, 2026
23 checks passed
@badcuban
badcuban deleted the feat/terminals-page branch November 21, 2026 00:15

This branch was previously deployed

1 inactive deployment
Preview — 078291ef Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add a Terminals workspace across projects

1 participant